package com.miracle.flexAPI.api.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.miracle.flexAPI.api.entity.SysCacheConfig;
import com.miracle.flexAPI.api.service.SysCacheConfigService;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;

/**
 * 缓存配置表(SysCacheConfig)表控制层
 *
 * @author miracle
 * @since 2021-09-03 10:41:18
 */
@RestController
@RequestMapping("sysCacheConfig")
@Api(value = "sysCacheConfig", tags = {"缓存配置表"})
public class SysCacheConfigController {

    @Resource
    private SysCacheConfigService sysCacheConfigService;

    @GetMapping(value = "list")
    @ApiOperation(value = "缓存配置表-列表")
    @ApiImplicitParams({

            @ApiImplicitParam(name = "cacheCode", value = "缓存配置代码", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cacheName", value = "缓存配置名称", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cacheTime", value = "缓存有效期（-1标识永久有效）", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cacheTimeEmpty", value = "空值有效期", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cachePrefix", value = "缓存ID前缀", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "状态(0:无效，1:有效)", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "remark", value = "备注", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "createBy", value = "创建人", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "createTime", value = "创建时间", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "updateBy", value = "更新人", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "updateTime", value = "更新时间", defaultValue = "", dataType = "String", paramType = "query"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message =
                    "cacheCode : 缓存配置代码\n" +
                            "cacheName : 缓存配置名称\n" +
                            "cacheTime : 缓存有效期（-1标识永久有效）\n" +
                            "cacheTimeEmpty : 空值有效期\n" +
                            "cachePrefix : 缓存ID前缀\n" +
                            "status : 状态(0:无效，1:有效)\n" +
                            "remark : 备注\n" +
                            "createBy : 创建人\n" +
                            "createTime : 创建时间\n" +
                            "updateBy : 更新人\n" +
                            "updateTime : 更新时间\n"
            )


    })
    public AjaxResult list(@ApiIgnore SysCacheConfig model) {
        return sysCacheConfigService.list(model);
    }


    @GetMapping(value = "add")
    @ApiOperation(value = "缓存配置表-添加")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cacheCode", value = "缓存配置代码", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cacheName", value = "缓存配置名称", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cacheTime", value = "缓存有效期（-1标识永久有效）", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cacheTimeEmpty", value = "空值有效期", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cachePrefix", value = "缓存ID前缀", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "状态(0:无效，1:有效)", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "remark", value = "备注", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "createBy", value = "创建人", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "createTime", value = "创建时间", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "updateBy", value = "更新人", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "updateTime", value = "更新时间", defaultValue = "", dataType = "String", paramType = "query"),
    })
    public AjaxResult add(@ApiIgnore SysCacheConfig dto) {
        return sysCacheConfigService.add(dto);
    }


    @GetMapping(value = "edit")
    @ApiOperation(value = "缓存配置表-编辑")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cacheCode", value = "缓存配置代码", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cacheName", value = "缓存配置名称", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cacheTime", value = "缓存有效期（-1标识永久有效）", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cacheTimeEmpty", value = "空值有效期", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cachePrefix", value = "缓存ID前缀", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "状态(0:无效，1:有效)", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "remark", value = "备注", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "createBy", value = "创建人", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "createTime", value = "创建时间", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "updateBy", value = "更新人", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "updateTime", value = "更新时间", defaultValue = "", dataType = "String", paramType = "query"),
    })
    public AjaxResult edit(@ApiIgnore SysCacheConfig dto) {
        return sysCacheConfigService.edit(dto);
    }


    @GetMapping(value = "delete")
    @ApiOperation(value = "缓存配置表-删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cacheCode", value = "缓存配置代码", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cacheName", value = "缓存配置名称", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cacheTime", value = "缓存有效期（-1标识永久有效）", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cacheTimeEmpty", value = "空值有效期", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "cachePrefix", value = "缓存ID前缀", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "状态(0:无效，1:有效)", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "remark", value = "备注", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "createBy", value = "创建人", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "createTime", value = "创建时间", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "updateBy", value = "更新人", defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "updateTime", value = "更新时间", defaultValue = "", dataType = "String", paramType = "query"),
    })
    public AjaxResult delete(@ApiIgnore SysCacheConfig dto) {
        return sysCacheConfigService.delete(dto);
    }

}
